import '../../helper/Helper.dart';

import '../helper/dioHelper2.dart';

class DCChartData {
  num ID;
  String TM;
  double FH;
  double JH;
  double N;

  DCChartData(this.ID, this.TM, this.FH, this.JH, this.N);
  DCChartData.fromJson(Map<String, dynamic> json)
      : ID = 0,
        TM = json["TM"],
        FH = json["FH"] * 1.0,
        JH = json["JH"] * 1.0,
        N = json["N"] * 1.0;
  Map<String, dynamic> toJson() => {
        'ID': ID,
        'TM': TM,
        'FH': FH,
        'JH': JH,
        'N': N,
      };

  static Future<List<DCChartData>?> GetList() async {
    var response = await DioHelper.Get2(
        "http://47.108.62.6:27701/api/v1", "/DC/ChartDataGet", {});

    if (response.statusCode == 200) {
      var x1 = <DCChartData>[];

      for (var x in response.data) {
        x1.add(DCChartData.fromJson(x));
      }
      return x1;
    }

    return null;
  }
}
